package com.sugon.modules.analyse.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * Echarts柱状图数据VO
 *
 * @version V1.0
 * @author: yuxd
 * @date: 2018年7月17日
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BarChartSeriesModel<T> implements Serializable {

    /**
     * 数据项名称
     */
    private String name;

    private String type = "bar";

    private ArrayList<T> data;

    public BarChartSeriesModel(String name, ArrayList<T> data) {
        this.name = name;
        this.data = data;
    }

    public BarChartSeriesModel() {
        this.data = new ArrayList<>();
    }

    public BarChartSeriesModel(String name) {
        this.name = name;
        this.data = new ArrayList<>();
    }

    public void add(T t) {
        this.data.add(t);
    }

}
